%
%
% RECOMMENDED IMPROVEMENTS
%
%
% -Gimbal lock. Link video from youtube that shows the effect. Add language that the X and Z axes align.
% - Quaternions. It can be shown that... Explain the Euler axis comes from the Eigenvector of the rotation matrix
% - Extend take home lessons of chapter kinematics by insights into Euler angles and quaternions
% - Equation 3.5 should be _0^2 T, not f(q)
% - Around Figure 3.3, solutions are given for \alpha and b, not for \alpha and \beta. 
% Link a video that shows how to get the Jacobian from DH matrices in Section 3.3.1 (see ecture notes)
% Add ellipsoid to linear algebra section http://ee263.stanford.edu/lectures/ellipsoids.pdf




%\documentclass[11pt]{scrbook} % use larger type; default would be 10pt

% WITH BLEED
% US Trade => 6x9, with a 0.125 bleed
% Adjust images size and gutter so tabs bleed by .125
% See https://www.createspace.com/Products/Book/InteriorPDF.jsp

%\documentclass[paper=6.14in:9.21in,pagesize=pdftex,11pt,twoside,openright]{scrbook}

\documentclass[paper=7in:9in,pagesize=pdftex,11pt,twoside,openright]{scrbook}


%openright
% Paper width
% W = 7.125in (7+0.125 --- bleed)
% Paper height
% H = 9.25in (9+2*.125 --- bleed)
% Paper gutter
% BCOR = 0.375in (0.5+0.5-0.625 --- margin with bleed)
% Margin (0.5in imposed on lulu, recommended on createspace)
% m = 0.625in (0.5+0.125 --- bleed)
% Text height
% h = H - 2m = 8in
% Text width
% w = W - 2m - BCOR = 4.5in
\areaset[0.375in]{5.5in}{8in}
\usepackage[utf8]{inputenc} % set input encoding (not needed with XeLaTeX)

% \usepackage{subfig} % make it possible to include more than one captioned figure/table in a single float
% Subfigure is deprecated
% Subfig is not compatible with hyperref
\usepackage{subcaption}
\captionsetup{format=plain,indention=.4cm,labelformat=simple, labelfont = sl, labelsep=period, font=small}
% \captionsetup[sub]{labelformat=simple,labelsep=period, font=small}

%%% Examples of Article customizations
% These packages are optional, depending whether you want the features they provide.
% See the LaTeX Companion or other references for full information.

\usepackage{mitpress}
\usepackage[usenames, dvipsnames, table]{xcolor}

\usepackage[framemethod=TikZ]{mdframed}
\mdfsetup{skipbelow=2pt, backgroundcolor=gray!8, linecolor=black!40}

\usepackage[top=1in, bottom=1in, left=1in, right=1in]{geometry}

\usepackage{graphicx} % support the \includegraphics command and options
%\usepackage{wrapfig}

% \usepackage[parfill]{parskip} % Activate to begin paragraphs with an empty line rather than an indent

%%% PACKAGES
\usepackage{booktabs} % for much better looking tables
\usepackage{array} % for better arrays (eg matrices) in maths
\usepackage{paralist} % very flexible & customisable lists (eg. enumerate/itemize, etc.)
\usepackage{verbatim} % adds environment for commenting out blocks of text & for better verbatim
% These packages are all incorporated in the memoir class to one degree or another...
\usepackage{amsmath}
\usepackage{mathtools}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{hyperref}
\usepackage{harvard}
\usepackage{fancyvrb}
\usepackage{marginnote}
\usepackage[capitalize, noabbrev]{cleveref} % Used to improve refernces
\usepackage{tikz}
\usetikzlibrary{automata, positioning}
\usepackage{tikz-qtree}
\usepackage{forest}
\usepackage{enumitem}
\usepackage[xindy]{imakeidx}

\colorlet{mylinkcolor}{BrickRed}
\colorlet{mycitecolor}{PineGreen}
\colorlet{myurlcolor}{NavyBlue}

\hypersetup{
  linkcolor  = mylinkcolor,
  citecolor  = mycitecolor,
  urlcolor   = myurlcolor,
  colorlinks = true,
}

\usepackage{makeidx}
\usepackage{idxlayout}

\usepackage{import}
\usepackage{xifthen}
\usepackage{pdfpages}
\usepackage{transparent}

% \let\comment=\relax
\usepackage[markup=bfit, deletedmarkup=sout, authormarkup=superscript, commandnameprefix=ifneeded]{changes}
\definechangesauthor[name={ar}, color=teal]{AR}
\definechangesauthor[name={nc}, color=green]{NC}
\definechangesauthor[name={bh}, color=blue]{BH}
\definechangesauthor[name={td}, color= red]{TODO}

\newcommand{\ar}[1]{\added[id=AR  ]{#1}}
\newcommand{\nc}[1]{\added[id=NC  ]{#1}}
\newcommand{\bh}[1]{\added[id=BH  ]{#1}}
\newcommand{\td}[1]{\added[id=TODO]{#1}}
%\newcommand{\cref}[1]{Section \ref{#1}}

\newcommand{\hjb}[1]{{\color{red}#1}}


% fixing a scrbook error when compiling the citations
\DeclareOldFontCommand{\bf}{\normalfont\bfseries}{\mathbf}

\DeclareUnicodeCharacter{00A0}{ }

%%% HEADERS & FOOTERS
%\usepackage{fancyhdr} % This should be set AFTER setting up the page geometry
%\pagestyle{fancy} % options: empty , plain , fancy
%\renewcommand{\headrulewidth}{0pt} % customise the layout...
%\lhead{}\chead{}\rhead{}
%\lfoot{}\cfoot{\thepage}\rfoot{}

%%% APPEARANCE OF SECTIONS
\usepackage[up,md,sf]{titlesec}

%%% APPEARANCE OF ToC (Table of Content)
%\usepackage[nottoc,notlof,notlot]{tocbibind} % Put the bibliography in the ToC
%\usepackage[titles,subfigure]{tocloft} % Alter the style of the Table of Contents

\newcommand{\screencast}[2]{
  \marginnote{\href{#1}{\includegraphics[trim=5 20 0 0, clip, width=1.8cm]{figs/youtube/#2}}}}


%%% END Article customizations

%%% The ``real'' document content comes below...
\makeindex

%\title{Introduction to Autonomous Robots}
%\author{Nikolaus Correll}
%\date{} % Activate to display a given date or no date (if empty),
         % otherwise the current date is printed

\allowdisplaybreaks

\begin{document}
%\maketitle


\thispagestyle{empty}
\begin{flushleft}
Nikolaus Correll, Bradley Hayes,\\ Christoffer Heckman, and Alessandro Roncone \\~\\
Introduction to Autonomous Robots:\\ Mechanisms, Sensors, Actuators, and Algorithms\\~\\
v3.0, \today\\
%Magellan Scientific\\
%ISBN-13: 978-1493773077
%ISBN-13: 978-0692700877
\end{flushleft}

\vfill

\begin{figure}[!h]
\includegraphics[width=1.2in]{figs/by-nc-nd}
\end{figure}

Copyright in this monograph has been licensed exclusively to The MIT Press, \url{http://mitpress.mit.edu}, which will be releasing the final version to the public in 2022. All inquiries regarding rights should be addressed to The MIT Press, Rights and Permissions Department.
Source code of this book is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0). You are free to share, i.e., copy, distribute and transmit sources under the following conditions: you must attribute the work to its main author, you may not use this work for commercial purposes, and if you remix or modify this work you may not distribute the modified material. For more information, please consult \url{https://creativecommons.org/licenses/by-nc-nd/4.0/}.


\cleardoublepage
\thispagestyle{empty}
\topskip0pt
\vspace*{\fill}
\begin{center}
For Arthur, Tatiana, Benedict and Silvester\\
David
\\
Leonardo and Lily\\
future robot users\\
\end{center}
\vspace*{\fill}

\tableofcontents

\chapter*{Preface}

This book provides an algorithmic perspective to autonomous robotics to students with a sophomore-level of linear algebra and probability theory. Robotics is an emerging field at the intersection of mechanical engineering, electrical engineering, and computer science. With computers becoming more powerful, making robots smart is getting more and more into the focus of attention and robotics research most challenging frontier. While there is a large number of textbooks on the mechanics and dynamics of robots available to sophomore-level undergraduates, books that provide a broad algorithmic perspective are mostly limited to the graduate level. This book has therefore been developed not to create ``yet another textbook, but better than the others'', but to allow us to teach robotics to the 3rd and 4th year undergraduates at the Department of Computer Science at the University of Colorado.

Although falling under the umbrella of ``Artificial Intelligence'', standard AI techniques are not sufficient to tackle problems that involve uncertainty, such as a robot's interaction in the real world. This book uses simple trigonometry to develop the kinematic equations of manipulators and mobile robots, then introduces path planning, sensing, and lastly uncertainty. The robot localization problem is introduced by formally defining error propagation, which leads to Markov localization, Particle filtering and finally the Extended Kalman Filter, and Simultaneous Localization and Mapping.

Instead of focusing on state-of-the-art solutions to a particular sub-problem, emphasis of the book is on a progressive step-by-step development concepts through recurrent examples that capture the essence of a problem. The described solutions might not necessarily be the best, however they are easy to comprehend and widely used in the community. For example, odometry and line-fitting are used to explain forward kinematics and least-squares solutions, respectively, and later serve as motivating examples for error propagation and the Kalman filter in a localization context.

Notably, the book is explicitly robot-agnostic, reflecting the timeliness of fundamental concepts. Rather, a series of possible project-based curricula are described in an Appendix and available online, ranging from a maze-solving competition that can be realized with most camera-equipped differential-wheel robots to manipulation experiments with a robotic arm, all of which can be entirely conducted in simulation to teach most of the core concepts.

After multiple years of development and distribution mainly via Github, this new edition of the book has been co-authored by my colleagues in the Computer Science department, Bradley Hayes, Christoffer Heckman, and Alessandro Roncone, each having thaught multiple iterations of our ``Introduction to Robotics'' and ``Advanced Robotics'' courses as well as special topics courses that pertain to their sub-fields of robotics research. They are adding not only tremendous technical depth, but also years of experience on how certain subjects should be taught to remain engaging and exciting.

This book is released under a Creative Commons CC BY-NC-ND 4.0 International license, which allows anyone to copy and share its source code. However, neither the compiled version nor the code shall be used to create derivatives for commercial purposes. We have chosen this format as it seems to maintain the best trade-off between a freely available textbook resource that others may contribute to and maintaining a consistent curriculum that others can refer to. We are incredibly grateful to MIT Press and our editor Elizabeth Swayne to support this forward-looking model.

Writing this book would not have been possible without the excellent work of others before us, most notably ``Introduction to Robotics: Mechanics and Control'' by John Craig and ``Introduction to Autonomous Mobile Robots'' by Roland Siegwart, Illah Nourbakhsh and Davide Scaramuzza, and innumerable other books and websites from which I learned and borrowed examples and notation. We are also grateful to Brian Amberg, Aaron Becker, Bachir El-Kadir,  James Grime, Michael Sambol, Cyrill Stachniss, Subh83, Ethan Tiran-Thompson who made lecture video snippets and animations available online, and which are referenced throughout the book using QR codes.

I would like to acknowledge Mike Miles and Harel Biggie, graduate students in the authors' shared laboratory at the University of Colorado Boulder, for their careful reading and contributions. I would also like to thank Prof. Chaoqun Wang from Shandong University, China, for the Chinese translation.  Finally, I would also like to acknowledge Github users AlWiVo, beardicus, mattvlaw, mguida22, aokeson, as1ndu, apnorton, JohnAllen, jmodares, countsoduku, choffmann, and chrstphrdlz for their pull requests and comments as well as Haluk Bayram. Your interest and motivation in this project has been one of our biggest rewards.

\begin{flushright}
Nikolaus Correll\\
Boulder, Colorado, \today
\end{flushright}

\input{chapters/introduction}

\part{Mechanisms}
\input{chapters/locomotion}
\input{chapters/kinematics}
\input{chapters/forces}
\input{chapters/grasping}

\part{Sensing and actuation}
\input{chapters/actuators}
\input{chapters/sensors}

\part{Computation}
\input{chapters/vision}
\input{chapters/features}
\input{chapters/deeplearning}
\input{chapters/taskexecution}
\input{chapters/mapping}
\input{chapters/pathplanning}
\input{chapters/manipulation}

\part{Uncertainty}
\input{chapters/errorpropagation}
\input{chapters/localization}
\input{chapters/SLAM}

\part{Appendices}
\appendix

\input{chapters/trigonometry}
\input{chapters/linearalgebra}
\input{chapters/statistics}
\input{chapters/backpropagation}

\input{chapters/paperwriting}
\input{chapters/samplecurricula}


\bibliographystyle{agsm}
\bibliography{robotics}

\printindex

\end{document}
